package io.scnb.design;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

public class CashCard extends BankCard{

    private Logger logger = LoggerFactory.getLogger(CashCard.class);

    public CashCard(String cardNo, String cardDate) {
        super(cardNo, cardDate);
    }

    @Override
    boolean rule(BigDecimal amount) {
        return true;
    }

    public String withdrawal(String orderId, BigDecimal amount) {
        logger.info("提现成功，单号：{} 金额：{}", orderId, amount);
        return "0000";
    }

    public String recharge(String orderId, BigDecimal amount) {
        logger.info("储蓄成功，单号：{} 金额：{}", orderId, amount);
        return "0000";
    }

    /**
     * 风险校验
     * @param cardNo
     * @param orderId
     * @param amount
     * @return
     */
    public boolean checkRisk(String cardNo, String orderId, BigDecimal amount) {
        // 模拟风险校验
        logger.info("风险校验，卡号：{}, 单号：{}, 金额：{}", cardNo, orderId, amount);
        return true;
    }
}
